package org.xiaofeipapa.scdemo.orderApi.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xiaofeipapa.scdemo.orderApi.OrderApiConfig;

import javax.annotation.Resource;

/**
 */
@RestController
@RefreshScope
public class OrderApiController {

    @Value("${server.port}")
    private String serverPort;

    @Value("${greeting.msg}")
    private String greeting;

    @GetMapping("/hello")
    public String hello(){
        return "我是 order service, 端口为： " + serverPort + ", " + greeting;
    }

    @Resource
    OrderApiConfig orderApiConfig;

    @GetMapping("/hello2")
    public String hello2(){
        return "我是 hello2, 端口为： " + serverPort + ", " + orderApiConfig.getMsg();
    }

}
